<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>产品列表</title>
    <link rel="stylesheet" href="/static/modules/api/Loanfilter/style/weui.css"/>
    <link rel="stylesheet" href="/static/modules/api/Loanfilter/example.css"/>
</head>
<body ontouchstart>
   <!--<div class="weui-toptips weui-toptips_warn js_tooltips">错误提示</div>-->

    <div class="container" id="container"></div>

    <script type="text/html" id="tpl_home">
<div class="page">

<c:forEach items="${loans}" var="loan">
    <div class="weui-cells__title"></div>
    <div class="weui-cells">
      <div class="page__bd">
        <div class="weui-form-preview">
            <div class="weui-form-preview__hd">
                <div class="weui-form-preview__item">

                    <label class="weui-form-preview__label">产品名称</label>
                    <em class="weui-form-preview__value">${loan.name}：匹配度（${loan.getNum}/${loan.sumNum}）</em>
                </div>
            </div>
            <div class="weui-form-preview__bd">
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">贷款额度</label>
                    <span class="weui-form-preview__value" style="color:#e84c3d;">¥ ${loan.minAmount}- ${loan.maxAmount}</span>
                </div>
                <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">利率</label>
                    <span class="weui-form-preview__value" style="color:#e84c3d;">${loan.minRate}-${loan.maxRate}</span>
                </div>
            </div>
            <div class="weui-form-preview__ft">
                <a class="weui-form-preview__btn weui-form-preview__btn_primary" href="/api/loan/getLoanDetailPage?loanId=${loan.id}">查看详情</a>
            </div>
        </div>
       </div>
	</div>
</c:forEach>

	
	
</div>
<script type="text/javascript">
    $(function(){
        var $tooltips = $('.js_tooltips');

        $('#showTooltips').on('click', function(){
            if ($tooltips.css('display') != 'none') return;

            // toptips的fixed, 如果有`animation`, `position: fixed`不生效
            $('.page.cell').removeClass('slideIn');

            $tooltips.css('display', 'block');
            setTimeout(function () {
                $tooltips.css('display', 'none');
            }, 2000);
        });
    });
</script>

<script type="text/javascript">
    $(function(){
        var winH = $(window).height();
        var categorySpace = 10;

        $('.js_item').on('click', function(){
            var id = $(this).data('id');
            window.pageManager.go(id);
        });
        $('.js_category').on('click', function(){
            var $this = $(this),
                $inner = $this.next('.js_categoryInner'),
                $page = $this.parents('.page'),
                $parent = $(this).parent('li');
            var innerH = $inner.data('height');
            bear = $page;

            if(!innerH){
                $inner.css('height', 'auto');
                innerH = $inner.height();
                $inner.removeAttr('style');
                $inner.data('height', innerH);
            }

            if($parent.hasClass('js_show')){
                $parent.removeClass('js_show');
            }else{
                $parent.siblings().removeClass('js_show');

                $parent.addClass('js_show');
                if(this.offsetTop + this.offsetHeight + innerH > $page.scrollTop() + winH){
                    var scrollTop = this.offsetTop + this.offsetHeight + innerH - winH + categorySpace;

                    if(scrollTop > this.offsetTop){
                        scrollTop = this.offsetTop - categorySpace;
                    }

                    $page.scrollTop(scrollTop);
                }
            }
        });
    });
</script>

   <script src="/static/modules/api/Loanfilter/zepto.min.js"></script>
   <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
   <script src="/static/modules/api/Loanfilter/weui.min.js"></script>
   <script src="/static/modules/api/Loanfilter/example.js"></script>
</body>
</html>
